﻿<Window x:Class="Demos.Convexhull.View"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:convexhull="clr-namespace:Demos.Convexhull"
        Title="Convexhull" Height="400" Width="500"
        Name="view">
    <Grid>
        <TabControl SelectedIndex="{Binding PestañaSeleccionada, UpdateSourceTrigger=PropertyChanged}">
            <TabItem Header="Manual">
                <Grid Margin="10">
                    <Grid.RowDefinitions>
                        <RowDefinition></RowDefinition>
                        <RowDefinition Height="auto"></RowDefinition>
                        <RowDefinition Height="auto"></RowDefinition>
                        <RowDefinition Height="auto"></RowDefinition>
                    </Grid.RowDefinitions>

                    <Border Grid.Row="0" BorderBrush="DarkGray" BorderThickness="1">
                        <convexhull:ContenedorPuntosUserControl
                                    ContenidoVisual="{Binding ContenidoVisorSimultaneo}"
                                    DataContext="{Binding ElementName=view, Path=DataContext}"/>
                    </Border>

                    <GroupBox Grid.Row="1" Margin="10,10,10,0" HorizontalAlignment="Center" Header="Algoritmos">
                        <StackPanel Orientation="Horizontal">
                            <RadioButton Margin="10" 
                                         IsChecked="{Binding SeleccionAlgoritmo[0], UpdateSourceTrigger=PropertyChanged}">
                                Quickhull</RadioButton>
                            <RadioButton Margin="10"
                                         IsChecked="{Binding SeleccionAlgoritmo[1], UpdateSourceTrigger=PropertyChanged}">
                                Graham</RadioButton>
                            <RadioButton Margin="10"
                                         IsChecked="{Binding SeleccionAlgoritmo[2], UpdateSourceTrigger=PropertyChanged}">
                                Greedy</RadioButton>
                        </StackPanel>
                    </GroupBox>

                    <Grid Grid.Row="2" Margin="10,10,10,0" HorizontalAlignment="Center">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition></ColumnDefinition>
                            <ColumnDefinition></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <Label Grid.Column="0" HorizontalAlignment="Right">Animación:</Label>
                        <Slider Grid.Column="1" Minimum="1" Maximum="2000" MinWidth="150"
                                Value="{Binding DuracionAnimacion, UpdateSourceTrigger=PropertyChanged}"></Slider>
                    </Grid>

                    <StackPanel Orientation="Horizontal" Grid.Row="3" Margin="10,10,10,0" HorizontalAlignment="Center">
                        <Button Height="25" Width="70" Margin="5" Command="{Binding ComenzarCommand}">Comenzar</Button>
                        <Button Height="25" Width="70" Margin="5" Command="{Binding PararCommand}">Parar</Button>
                        <Button Height="25" Width="70" Command="{Binding LimpiarCommand}">Limpiar</Button>
                    </StackPanel>
                </Grid>
            </TabItem>
            
            <TabItem Header="Simultáneo">
                <Grid Margin="10">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="auto"></RowDefinition>
                        <RowDefinition></RowDefinition>
                        <RowDefinition Height="auto"></RowDefinition>
                        <RowDefinition Height="auto"></RowDefinition>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition></ColumnDefinition>
                        <ColumnDefinition></ColumnDefinition>
                        <ColumnDefinition></ColumnDefinition>
                    </Grid.ColumnDefinitions>

                    <Label Grid.Row="0" Grid.Column="0" HorizontalAlignment="Center">Quickhull</Label>
                    <Label Grid.Row="0" Grid.Column="1" HorizontalAlignment="Center">Graham</Label>
                    <Label Grid.Row="0" Grid.Column="2" HorizontalAlignment="Center">Greedy</Label>
                    
                    <Border Grid.Row="1" Grid.Column="0" BorderBrush="DarkGray" BorderThickness="1">
                        <convexhull:ContenedorPuntosUserControl
                                    ContenidoVisual="{Binding ContenidoVisorQuickhull}"
                                    DataContext="{Binding ElementName=view, Path=DataContext}"/>
                    </Border>

                    <Border Grid.Row="1" Grid.Column="1" BorderBrush="DarkGray" BorderThickness="1">
                        <convexhull:ContenedorPuntosUserControl
                                    ContenidoVisual="{Binding ContenidoVisorGraham}"
                                    DataContext="{Binding ElementName=view, Path=DataContext}"/>
                    </Border>

                    <Border Grid.Row="1" Grid.Column="2" BorderBrush="DarkGray" BorderThickness="1">
                        <convexhull:ContenedorPuntosUserControl
                                    ContenidoVisual="{Binding ContenidoVisorGreedy}"
                                    DataContext="{Binding ElementName=view, Path=DataContext}"/>
                    </Border>

                    <Grid Grid.Row="2" Grid.ColumnSpan="3" Margin="10,10,10,0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition></ColumnDefinition>
                            <ColumnDefinition></ColumnDefinition>
                            <ColumnDefinition></ColumnDefinition>
                            <ColumnDefinition></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <Label HorizontalAlignment="Right">Puntos a generar:</Label>
                        <TextBox Grid.Column="1" Margin="5" 
                                 Text="{Binding NumeroPuntosInsertar, UpdateSourceTrigger=PropertyChanged}"></TextBox>
                        <Label Grid.Column="2" HorizontalAlignment="Right">Animación:</Label>
                        <Slider Grid.Column="3" Minimum="1" Maximum="2000"
                                Value="{Binding DuracionAnimacion, UpdateSourceTrigger=PropertyChanged}"></Slider>
                    </Grid>
                    
                    <StackPanel Grid.Row="3" Grid.ColumnSpan="3" Margin="10,10,10,0" HorizontalAlignment="Center" Orientation="Horizontal">
                        <Button Height="25" Width="100" Margin="5" Command="{Binding GenerarPuntosCommand}">
                            Generar puntos</Button>
                        <Button Height="25" Width="100" Margin="5" Command="{Binding ComenzarCommand}">Comenzar</Button>
                        <Button Height="25" Width="100" Margin="5" Command="{Binding PararCommand}">Parar</Button>
                        <Button Height="25" Width="100" Margin="5" Command="{Binding LimpiarCommand}">Limpiar</Button>
                    </StackPanel>
                </Grid>
            </TabItem>
        </TabControl>
    </Grid>
</Window>
